using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using EventSys.Repository.Mapping;

//Importamos
using EventSys.BussinesEntities;

namespace EventSys.Repository
{
    public partial class DBEventSysContext : DbContext
    {
        static DBEventSysContext()
        {
            DBEventSysContext ct = new DBEventSysContext();
            if (!ct.Database.Exists())
            {
                Database.SetInitializer<DBEventSysContext>(

                    (new CreateDatabaseIfNotExists <DBEventSysContext>())
                    //new DropCreateDatabaseIfModelChanges<DBEventSysContext>()
                    //new PraxisRentDatabaseInitializer()

            );
            }
            else
            {

                Database.SetInitializer<DBEventSysContext>(


                    null
                );
            }


            //Database.SetInitializer<DBEventSysContext>( null );
        }

        public DBEventSysContext()
            : base("Name=DBEventSysContext")
        {
        }

        public DbSet<Actividad> Actividads { get; set; }
        public DbSet<Ambiente> Ambientes { get; set; }
        public DbSet<Auspiciador> Auspiciadors { get; set; }
        public DbSet<Carrera> Carreras { get; set; }
        public DbSet<CotrolAsistencia> CotrolAsistencias { get; set; }
        public DbSet<DetAuspiciador> DetAuspiciadors { get; set; }
        public DbSet<Director> Directors { get; set; }
        public DbSet<Estado> Estadoes { get; set; }
        public DbSet<Evento> Eventoes { get; set; }
        public DbSet<Facultad> Facultads { get; set; }
        public DbSet<FormaPago> FormaPagoes { get; set; }
        public DbSet<Inscripcion> Inscripcions { get; set; }
        public DbSet<Inversion> Inversions { get; set; }
        public DbSet<Material> Materials { get; set; }
        public DbSet<Participante> Participantes { get; set; }
        public DbSet<sysdiagram> sysdiagrams { get; set; }
        public DbSet<TipoActividad> TipoActividads { get; set; }
        public DbSet<TipoParticipante> TipoParticipantes { get; set; }
        public DbSet<Ubicacion> Ubicacions { get; set; }
        public DbSet<Ubigeo> Ubigeos { get; set; }
        public DbSet<UserProfile> UserProfiles { get; set; }
        public DbSet<webpages_Membership> webpages_Membership { get; set; }
        public DbSet<webpages_OAuthMembership> webpages_OAuthMembership { get; set; }
        public DbSet<webpages_Roles> webpages_Roles { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new ActividadMap());
            modelBuilder.Configurations.Add(new AmbienteMap());
            modelBuilder.Configurations.Add(new AuspiciadorMap());
            modelBuilder.Configurations.Add(new CarreraMap());
            modelBuilder.Configurations.Add(new CotrolAsistenciaMap());
            modelBuilder.Configurations.Add(new DetAuspiciadorMap());
            modelBuilder.Configurations.Add(new DirectorMap());
            modelBuilder.Configurations.Add(new EstadoMap());
            modelBuilder.Configurations.Add(new EventoMap());
            modelBuilder.Configurations.Add(new FacultadMap());
            modelBuilder.Configurations.Add(new FormaPagoMap());
            modelBuilder.Configurations.Add(new InscripcionMap());
            modelBuilder.Configurations.Add(new InversionMap());
            modelBuilder.Configurations.Add(new MaterialMap());
            modelBuilder.Configurations.Add(new ParticipanteMap());
            modelBuilder.Configurations.Add(new sysdiagramMap());
            modelBuilder.Configurations.Add(new TipoActividadMap());
            modelBuilder.Configurations.Add(new TipoParticipanteMap());
            modelBuilder.Configurations.Add(new UbicacionMap());
            modelBuilder.Configurations.Add(new UbigeoMap());
            modelBuilder.Configurations.Add(new UserProfileMap());
            modelBuilder.Configurations.Add(new webpages_MembershipMap());
            modelBuilder.Configurations.Add(new webpages_OAuthMembershipMap());
            modelBuilder.Configurations.Add(new webpages_RolesMap());
        }
    }
}
